#ifndef __AS_ADVBAR__H__
#define __AS_ADVBAR__H__

/*
 *	attention : advertisement is singleton pattern
 *  it do not contain create or destroy method
 */

#include "ASControl.h"

#ifdef AS_RUN_ON_SKY
#include "..\plat\sky\app_suit\src\mrc_advbar.h"
#endif

#define AS_ADV_MAX_CNTS 8

typedef enum
{
    AS_ADV_DLOK = NOTIFY_EVENT_DOWNLOAD_DONE,
    AS_ADV_BRWOK = NOTIFY_EVENT_BROWSER_DONE,
    AS_ADV_CLICKOK = NOTIFY_EVENT_ADV_CLICK,
} as_advbar_evt;

typedef ASVOID (*pause_hdlr)(ASVOID);
typedef ASVOID (*resume_hdlr)(ASVOID);
typedef ASVOID (*load_cb_hdlr)(ASINT result);
typedef ASVOID (*activity_cb_hdlr)(ASINT result);
typedef ASVOID (*done_evt_cb_hdlr)(as_advbar_evt type);

typedef struct
{
    /*base*/
    as_control base;

    ASBOOL if_inited;
    ASBOOL if_loaded;
    ASBOOL if_focused;
    ASINT core_key;
    as_void_func dlok_func;
    as_void_func brok_func;
    ASUINT adv_ids[AS_ADV_MAX_CNTS];
    ASUINT adv_id_cnts;
    ASUINT adv_cur_idx;

    ASVOID (*change_id)(as_control* ctrl_p, ASUINT id);
    ASVOID (*set_focus)(as_control* ctrl_p, ASBOOL if_focus);
    ASBOOL (*get_focus)(as_control* ctrl_p);
    ASVOID (*refresh)(as_control* ctrl_p, ASBOOL if_force);
    ASVOID (*set_key)(as_control* ctrl_p, ASINT key);
    ASVOID (*set_dlok_cb)(as_control* ctrl_p, as_void_func dlok);
    ASVOID (*set_brok_cb)(as_control* ctrl_p, as_void_func brok);
    ASVOID (*set_ids)(as_control* ctrl_p, ASUINT id_cnts, ASUINT* ids);

} as_advbar;

as_advbar* as_ctrl_advbar_create(as_rect area, ASUINT id, ASBOOL small_font);
as_ret as_ctrl_advbar_destroy(as_advbar* ctrl_advbar_p);
as_advbar* as_ctrl_adbar_get_instance(void);
void as_advbar_flush(void);

#endif//__AS_ADVBAR__H__